{% extends "simgenex/base_simgenex.html" %}
{%block center%}
<div>
    <h2>{{request.session.sgx_program.name}}</h2>
    <p>
        {{request.session.sgx_program.desc}}
    </p>
    <form action="examineTranssysModel" method="post" class="edit">
        {% csrf_token %}
        <fieldset class="border" id="disciminationSetup">
            <legend>Setup</legend>
            <span class="helptext">In this page, you can examine the transsys model by comparing the simulated expression set to the target expression set</span>
            <div class="input-field">
                <label>Candidates</label>
                <span class="helptext">Select the transsys programs which you want to apply the experiment (You can select more than one transsys programs)</span>
                <select name="candidates" multiple="multiple">
                    {% for tsp in request.session.sgx_program.target_tp %}
                        <option value="{{tsp.name}}">{{tsp.name}}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="input-field">
                <label>Target expression data</label>
                <select name="target_data" >
                    {% for ex_set in request.session.sgx_program.target_expression_data.keys %}
                        <option value="{{ex_set}}"
                                {% if ex_set == input.target_data %}
                                    selected="selected"
                                {% endif %}
                        >{{ex_set}}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="input-field">
            <button type="submit" name="submit">Run Simulation</button>
        </div>
        </fieldset>
        
    </form>
    {% if result %}
    <div id="simulation_result">
        <h2>Result:</h2>
        <span class="helptext">The results are distances between each simulated expression level matrix and the target expression dataset. The smaller fitness result the closer simulated matrix to target expression data.</span>
        <table id="discrimination_result" class="tablesorter">
            <thead>
                <tr>
                    <th>Transsys Program</th>
                    <th>Fitness Result</th>
                </tr>
            </thead>
            <tbody>
                {% for k,v in result.items %}
                    <tr>
                        <td>{{k}}</td>
                        <td>{{v.fitness}}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
        
    </div>
    {% endif %}
</div>
{% endblock %}